package com.geeker.module.sys.menu.domain;

import java.util.ArrayList;
import java.util.List;

import com.mybatisflex.annotation.Column;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Data;

@Data
@Schema(description = "菜单权限表")
public class SysMenu {

    @Schema(description = "菜单ID")
    private Long menuId;

    @Schema(description = "菜单名称")
    @NotBlank(message = "菜单名称不能为空")
    @Size(min = 0, max = 50, message = "菜单名称长度不能超过50个字符")
    private String menuName;


    @Schema(description = "父菜单名称")
    @Column(ignore = true)
    private String parentName;

    @Schema(description = "父菜单ID")
    private Long parentId;

    @Schema(description = "显示顺序")
    @NotNull(message = "显示顺序不能为空")
    private Integer orderNum;


    @Schema(description = "路由地址")
    @Size(min = 0, max = 200, message = "路由地址不能超过200个字符")
    private String path;


    @Schema(description = "组件路径")
    @Size(min = 0, max = 200, message = "组件路径不能超过255个字符")
    private String component;

    @Schema(description = "路由参数")
    private String query;

    /**
     * 路由名称，默认和路由地址相同的驼峰格式（注意：因为vue3版本的router会删除名称相同路由，为避免名字的冲突，特殊情况可以自定义）
     */
    private String routeName;


    @Schema(description = "是否为外链（0是 1否）")
    private String isFrame;


    @Schema(description = "是否缓存（0缓存 1不缓存）")
    private String isCache;

    /**
     * 类型（M目录 C菜单 F按钮）
     */
    @NotBlank(message = "菜单类型不能为空")
    private String menuType;

    /**
     * 显示状态（0显示 1隐藏）
     */
    @Schema(description = "显示状态")
    private Integer visible;

    private Integer status;

    @Schema(description = "权限字符串")
    @Size(min = 0, max = 100, message = "权限标识长度不能超过100个字符")
    private String perms;


    @Schema(description = "菜单图标")
    private String icon;


    @Schema(description = "子菜单")
    @Column(ignore = true)
    private List<SysMenu> children = new ArrayList<SysMenu>();
}
